<?php


namespace app\index\controller;


use app\common\model\User;
use app\index\model\Test;
use come\Db;
use come\Captcha;
use come\Log;
use come\Request;
use come\Session;

class TestController
{
    protected $request;

    /**
     * 构造方法
     * @param Request $request Request对象
     * @access public
     */
    public function __construct()
    {
        //$this->request = $request;
        dump(md5('e10adc3949ba59abbe56e057f20f883e'));
        Db::name('user')->insert(array('username'=>'admin','password'=>'14e1b600b1fd579f47433b88e8d85291'));

    }

    function indexAction(){
/**/
        $regex ='\{((?:[\$]{1,2}[a-wA-w_]|[\/if]|[\:\~][\$a-wA-w_]|[if\(][\w]|[+]{2}[\$][a-wA-w_]|[-]{2}[\$][a-wA-w_]|\/[\*\/])(?>[^}]*))\}';

        $regex = '/' . $regex . '/is';
        $content = '{/*/}}{ if(Dump(12)==6)}{/if}';
        dump(preg_match_all($regex, $content, $matches, PREG_SET_ORDER));
        dump($matches);
        /*dump($_SESSION);
        dump(Session::get("session_user"));*/

        /*$user = User::find()->where("uid=0")->getOne();
        dump($user);

        $users = User::find()->where("uid=0")->page(2)->getAll();
        dump($users);*/
    }

    function  runAction(){
        $row = Test::read();
        dump($row);
        //dump($this->request->getControllerName());
        return view();
    }
}
